﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:OMANE_Modules_TauxGarantis_ViewModels="clr-namespace:OMANE.Modules.TauxGarantis.ViewModels" 
             xmlns:TxGar="clr-namespace:OMANE.Modules.TauxGarantis" 
             xmlns:ig="http://infragistics.com/Editors"    
             x:Class="Views.ViewCorrespondance" 
             mc:Ignorable="d"  Width="650" Height="450">
    <UserControl.Resources>
        <TxGar:BooleanConverter x:Key="BooleanConverter"></TxGar:BooleanConverter>
        <TxGar:EtatChampsConverter x:Key="EtatChampsConverter"></TxGar:EtatChampsConverter>
    </UserControl.Resources>
    <Grid>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="*"/>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="*"/>
    		<RowDefinition Height="Auto" />
    	</Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition  />
            <ColumnDefinition  />
        </Grid.ColumnDefinitions>
		<GroupBox Style="{DynamicResource OMANE_GpeBox}" Header="Champs Source" >
			<UniformGrid Margin="5" Columns="2" Rows="4">
				<TextBlock Text="Nom du Champ" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5,0"/>
                <TextBlock Text="{Binding CorrespondanceConsultee.chBDD.Nom}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0"/>
				<TextBlock Text="Format de Stockage" VerticalAlignment="Center" 
                           HorizontalAlignment="Right" Margin="5,0"/>
                <TextBlock Text="{Binding CorrespondanceConsultee.chBDD.Format.typeStock.Name}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0"/>
				<TextBlock Text="Format d'affichage" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5,0"/>
                <TextBlock Text="{Binding CorrespondanceConsultee.chBDD.Format.typeAff.Name}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0"/>
				<TextBlock Text="In Format" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5,0"/>
			    <ComboBox VerticalAlignment="Center" 
                          HorizontalAlignment="Left" 
                          MinWidth="100" 
                          Margin="5,0" 
                          ItemsSource="{Binding CorrespondanceConsultee.informat.NomsInformatPoss}"
                          SelectedItem="{Binding CorrespondanceConsultee.informat.nom}"/>
                <!--SelectedItem="{Binding CorrespondanceConsultee.informat.nom}"-->
            </UniformGrid>
		</GroupBox>
		<GroupBox Grid.Column="1" Style="{DynamicResource OMANE_GpeBox}" Header="Champ Importé" >
			<UniformGrid Margin="5" Columns="2" Rows="4">
				<TextBlock Text="Nature" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5,0"/>
                <TextBlock Text="{Binding CorrespondanceConsultee.description}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0"/>
				<TextBlock Text="Format" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5,0"/>
                <TextBlock Text="{Binding CorrespondanceConsultee.chOutil.Format.typeAff.Name}" 
                           VerticalAlignment="Center" 
                           HorizontalAlignment="Left" 
                           Margin="5,0"/>
				<TextBlock Text="Valeur Fixe" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,0"/>
                <!--<ig:XamMaskedEditor 
                    HorizontalAlignment="Left" 
                    Width="100" Margin="5,0" 
                    IsAlwaysInEditMode="True"
                    VerticalAlignment="Center"  Mask="='{char:8:0-9A-Z}'" DisplayMode="Raw" />-->

                <TextBox x:Name="TxtValFixe" IsEnabled="{Binding IsTxtValFixeEnabled}" HorizontalAlignment="Left" MinWidth="100" Margin="5,0" VerticalAlignment="Center" Text="{Binding ValeurFixeChampImporte}" />
				<TextBlock  TextWrapping="Wrap" Text="Var. de Segmentation" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,0"/>
			    
                <ComboBox HorizontalAlignment="Left" 
                          MinWidth="100" Margin="5,0" 
                          VerticalAlignment="Center"
                          ItemsSource="{Binding VariableSegItemsSource}"
                          SelectedValue="{Binding CorrespondanceConsultee.possSeg, Converter={StaticResource BooleanConverter}}" >
			    </ComboBox>
			
            </UniformGrid>
		</GroupBox>
        <StackPanel Visibility="{Binding IsValeursSourceVisible}" Orientation="Horizontal" Grid.Row="1" Grid.Column="0">
            <TextBlock Style="{DynamicResource TextBlockOMANE}" VerticalAlignment="Center" Text="Valeurs de la source" Margin="10,5,0,5" />
            <Button Margin="20,5,0,5" 
                    Command="{Binding CmdRefreshValuesSource}"
                    CommandParameter="{Binding CorrespondanceConsultee}" >Actualiser</Button>
        </StackPanel>
        <TextBlock Style="{DynamicResource TextBlockOMANE}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Text="Valeurs Attendues en Cible" Margin="10,5,0,5" />
        <DataGrid Grid.Row="2" 
                  Margin="10,0"
                  IsReadOnly="True"
                  Visibility="{Binding IsValeursSourceVisible}"
                  ItemsSource="{Binding CorrespondanceConsultee.chOutil.valeursDistinctes}" />
        <DataGrid Grid.Column="1" 
                  Grid.Row="2" 
                  Margin="10,0"
                  IsReadOnly="True"
                  ItemsSource="{Binding CorrespondanceConsultee.ContraintesVal}" />
		
        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Left" >
            <TextBlock Style="{DynamicResource TextBlockOMANE}" Text="Etat De la correspondance" VerticalAlignment="Center" Margin="5,0,0,0"/>
            <Button Margin="7" Height="18" Width="18" 
                    Background="{Binding CorrespondanceConsultee.etat, Converter={StaticResource EtatChampsConverter}}"
                    BorderBrush="{Binding CorrespondanceConsultee.etat, Converter={StaticResource EtatChampsConverter}}"></Button>
                <ContentControl />
		</StackPanel>
		<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" >
			<Button Content="OK" Width="60" Margin="0,5,5,5" Click="Button_Click" Command="{Binding OKCommand, Mode=OneWay}" />
			<Button Content="Annuler" Width="60" Margin="0,5,5,5" IsCancel="True" IsDefault="True" Click="Button_Click" Command="{Binding AnnulerCommand, Mode=OneWay}" />
		</StackPanel>
    </Grid>
</UserControl>
